import Vue from "vue";
import Vuex from "vuex";
import axios from "axios";
Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    count: 0,
    // list:[],
    banners: [],
   
  },
  getters: {
    count10(state) {
      return state.count*10
    }
  },
  mutations: {
    setcount(state) {
      state.count++
    },
    SET_BANNER(state, data) {
      state.banners=data
    },
    // SET_LIST(state, data) {
    //   state.list = data
    // }
  },
  actions: {
      GetBanner(context) {
        axios({
          url: 'https://gank.io/api/v2/banners'
        }).then(res => {
          context.commit('SET_BANNER',res.data.data)
        })
    },
    //  getList({ commit }) {
    //     axios({
    //       url: "https://gank.io/api/v2/data/category/All/type/All/page/1/count/12"
    //     }).then(res => {
    //        commit('SET_LIST', res.data.data)
    //       // console.log(res)
    //     })
    //   },
  },
     
  modules: {},
});
